package com.jly.mapper;

import com.jly.po.User;
import com.jly.po.vo.OrderVO;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.io.IOException;
import java.util.List;

public interface OrderAnnotationMapper {

    @Select("select * from tb_orders")
    @Results({
            @Result(id=true,property = "id",column = "id"),
            @Result(property = "orderTime",column = "order_time"),
            @Result(property = "total",column = "total"),
            @Result(property = "userId",column = "user_id"),
            @Result(property = "user",column = "user_id",
                    javaType = User.class,
                    one = @One(select =
                            "com.jly.mapper.UserAnnotationMapper.findById"))
    })
    List<OrderVO> findAll() throws IOException;

}
